package com.cebbank.yyi.springbootapp.jingtang.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

@Getter
@AllArgsConstructor
public enum DocType {

    MANAGE_MANUAL("1", "manageManual/page", "管理手册", "MANUAL", "gssc"),
    COMPANY_REGIME("2", "companyRegime/page", "公司级规章制度", "REGULATORY", "gzzdwj-gsjgzzd"),
    DEPARTMENT_RULES("3", "departmentRules/pageList", "部门级规章制度", "REGULATORY_ORG", "1807763950231216130"),
    PRODUCT_CRAFT("3", "productCraft/page", "生产技术文件", "ASSIGNMENT", "scjs");

    private final String code;
    private final String name;
    private final String desc;
    private final String directoryType;
    private final String directoryId;


    public static DocType fromDesc(String desc) {
        for (DocType docType : DocType.values()) {
            if (docType.getDesc().equals(desc)) {
                return docType;
            }
        }
        return null;
    }

    public static DocType containDesc(String desc) {
        for (DocType docType : DocType.values()) {
            if (desc.contains(docType.getDesc())) {
                return docType;
            }
        }
        return null;
    }
}
